#include #include using namespace std; void main() { string s = "Bob"; //s is an object - a variable with operations (functions) //intrinsic vs complex or user-defined s = "Sam"; //assignment ... strcpy cout << s << endl; int length = s.length(); // strlen //cin >> s; //s can be any size getline(cin,s); s.append("yay"); //strcat cout << s << endl; cout << s.substr(2,5) << endl; string s2 = s.substr(2); cout << s2 << endl; if(s == "Sam") //strcmp(,) == 0 { cout << "Yes, that is Sam" << endl; } if(stricmp(s.c_str(),"Sam") == 0) //strcmp(,) == 0 { cout << "Yes, that is Sam" << endl; } unsigned int i = s.find("bob"); cout << i << endl; cout << string::npos << endl; if(s.find("bob") != string::npos) { cout << "We found bob" << endl; } // buffer is a temporary storage area in memory int x; char c; string s3; cin >> x; cin >> c; //getline(cin,s3); cin.ignore(cin.rdbuf()->in_avail(),'\n'); getline(cin,s3); cout << x << endl; cout << c << endl; cout << s3 << endl; }